package com.joysuch.wwyt.dzhapi.exception;

import com.joysuch.wwyt.core.enums.Status;

import java.io.Serializable;

/**
 * @author: JamesZY
 * @date: 2021/9/16
 * @description:API接口异常
 */
public class ApiException extends RuntimeException implements Serializable {
    /**
     * 状态
     */
    private String status;
    /**
     * 返回码
     */
    private int code;
    /**
     * 返回信息
     */
    private String message;

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String errMsg) {
        this.message = errMsg;
    }

    public ApiException() {
    }

    public ApiException(Status status) {
        this.status = Status.ERROR_STATUS;
        this.code = status.getCode();
        this.message = status.getMsg();
    }

    public ApiException(String status, int code, String errMsg) {
        this.status = status;
        this.code = code;
        this.message = errMsg;
    }
}
